--This behavior changes the pare of corresponding images (qtvr menu item and plane diagram) when you roll over one of them and then passes the mouseUp event to the castMember script.Each menu consists of 5 pares of items and each item has 3 states:
--
--1) neutral: when it's not selected and not rolled over
--2)rolledOver: when it's not selected and rolled over
--3)hilited: when it's selected
--
--Corresponding castMembers are always located in curtain order in the internal cast.It makes it possible to switch between them depending on the item's state by manipulating their castNum.
set qtvrPlaneSprNum = getSpriteNumFromMemberName("qtvranchor")+1
set range = NumOfQTVRMenuItems - 1
set exteriorSpriteNum = qtvrPlaneSprNum + range
if gSelct <> (the spritenum of me/2*2) then
set the castnum of sprite the spritenum of me¼
to the castnum of sprite the spritenum of me + range
--if not exterior set also the linked menu item
if the spritenum of me <> exteriorSpriteNum then
if the spritenum of me/2*2 = the spritenum of me then
--even sprite number:rolled over the plane diagram, have to change menu item
set the castnum of sprite the spritenum of me +1 to the castnum of sprite the spritenum of me - 1
else
--odd sprite number:rolled over the menu item, have to change plane diagram
set the castnum of sprite the spritenum of me -1 to the castnum of sprite the spritenum of me + 1
updatestage
end if
end if
puppetsound 3, "subroll"
end if
set rolledOver = TRUE
end if
end
on mouseleave me
global gSelct, NumOfQTVRMenuItems
if rolledOver then
set qtvrPlaneSprNum = getSpriteNumFromMemberName("qtvranchor")+1
set range = NumOfQTVRMenuItems - 1
set exteriorSpriteNum = qtvrPlaneSprNum + range
if gSelct <> (the spritenum of me/2*2) then
set the castnum of sprite the spritenum of me to ¼
the castnum of sprite the spritenum of me -range
--if not exterior set also the linked menu item
if the spritenum of me <> exteriorSpriteNum then
if the spritenum of me/2*2 = the spritenum of me then
--even sprite number:rolled over the plane diagram, have to change menu item
set the castnum of sprite the spritenum of me +1 to¼
the castnum of sprite the spritenum of me - 1
else
--odd sprite number:rolled over the menu item, have to change plane diagram
set the castnum of sprite the spritenum of me-1 to¼
the castnum of sprite the spritenum of me + 1
updatestage
end if
end if
end if
set rolledOver = FALSE
end if
end
on mouseup me
-- First three enclosing if statements are for synchronization purposes.To make sure that all lingo commands caused by previouse qtvr menu item selection were executed before a new item can be selected.
global gSelct, NumOfQTVRMenuItems, gImage, imageName, gQTVRmenuEnabled
if rolledOver then
if the frame <> marker("qtvr") then
if gQTVRmenuEnabled then
set gQTVRmenuEnabled = FALSE
set qtvrPlaneSprNum = getSpriteNumFromMemberName("qtvranchor")+1
set range = NumOfQTVRMenuItems - 1
set exteriorSpriteNum = qtvrPlaneSprNum + range
puppetsound 3,"mouse5"
if gSelct <> (the spritenum of me/2*2) and gSelct <>"" then
set the castnum of sprite gSelct to gImage
if gSelct <> exteriorSpriteNum then set the castnum of sprite gSelct+1 to gImage-1
end if
if gSelct <> (the spritenum of me/2*2) then
set gSelct = the spritenum of me/2*2
set gImage = the castnum of sprite (the spritenum of me/2*2) - range
set the castnum of sprite the spritenum of me to the castnum of sprite the spritenum of me +range
end if
--if not exterior set also the linked menu item
if the spritenum of me <> exteriorSpriteNum then
if the spritenum of me/2*2=the spritenum of me then
--even sprite number
set the castnum of sprite the spritenum of me +1 to the castnum of sprite the spritenum of me - 1
else
set the castnum of sprite the spritenum of me -1 to the castnum of sprite the spritenum of me+1
end if
end if
set imageName = the name of member gImage
-- sendAllSprites(#CDSmallMenuPuppetsOff)
pass
end if
end if
end if
end
on resetRolledover me
-- This handler is called when "return to aircraft" button on Avionics Intro screen is clicked